package net.wanho.client;

import net.wanho.config.MyLoadBalancerConfig;
import net.wanho.entity.User;
import net.wanho.vo.AjaxResult;
import org.springframework.cloud.loadbalancer.annotation.LoadBalancerClients;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * Author：汤小洋
 * Date：2024-04-03 10:43
 * Description：<描述>
 */
// @FeignClient("user-provider")
@FeignClient(value = "cloud-gateway", fallback = UserClientFallback.class)
@LoadBalancerClients(defaultConfiguration = MyLoadBalancerConfig.class)
public interface UserClient {

    @GetMapping("/api/v2/users/test")
    public String test();

    @GetMapping("/api/v2/users")
    AjaxResult list(@RequestParam("username") String username);

    @PostMapping("/api/v2/users")
    AjaxResult add(@RequestBody User user);
}
